package org.erp.product.infrastructure.enums;

import lombok.Getter;

/**
 * 接驳记录状态
 * @author libin
 * @version 1.0
 * @description: 接驳记录状态
 * @date 2025/11/14 10:42
 **/
@Getter
public enum ConnectStatusEnum {
    WAITING_FOR_CONNECTION(0, "待接驳"),
    CONNECTED(1, "已接驳"),
    IN_THE_REJECTION(2, "驳回中"),
    REVOKED(3, "已撤销"),
    DISMISSED(4, "已驳回");

    private final Integer code;
    private final String message;

    ConnectStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Integer getCodeByMessage(String message) {
        for (ConnectStatusEnum item : ConnectStatusEnum.values()) {
            if (item.getMessage().equals(message)) {
                return item.getCode();
            }
        }
        return null;
    }

    public static String getMessageByCode(Integer code) {
        for (ConnectStatusEnum item : ConnectStatusEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getMessage();
            }
        }
        return null;
    }

    public static ConnectStatusEnum getByCode(Integer code) {
        for (ConnectStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static ConnectStatusEnum getByMessage(String message) {
        for (ConnectStatusEnum value : values()) {
            if (value.getMessage().equals(message)) {
                return value;
            }
        }
        return null;
    }
}
